﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VietThinks.Model
{
    public abstract class DomainEntity<TKey> : DomainEntity
        where TKey : struct
    {
        /// <summary>
        /// Id of domain entity.
        /// </summary>
        public new virtual TKey Id
        {
            get
            {
                return (TKey)(base.Id ?? default(TKey));
            }
            protected set
            {
                base.Id = value;
            }
        }

        /// <summary>
        /// Returns true if domain entity is transient (not exist in repository just yet).
        /// Returns false otherwise.
        /// </summary>
        public override bool IsTransient
        {
            get
            {
                return base.Id == null || base.Id.Equals(default(TKey));
            }
        }

        public virtual long Version { get; protected set; }
    }

    public interface IReadOnly
    {

    }
}
